added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2008 / CSVSPackageAddReferenceTab / ReadMe.txt
blobb976313e1b50c7365c02dd59c902443ac0643280
1 ================================================================================
2        VSX application : CSVSPackageAddReferenceTab Project Overview                        
3 ===============================================================================
5 /////////////////////////////////////////////////////////////////////////////
6 Use:
8 Visual Studio supports to extend the Add Reference dialog and add custom
9 tab page into the dialog.
11 This sample demostrate you how to add a custom .NET user control as a tab 
12 page into the add reference dialog, and how to enable select button and
13 handle item selection events.
15 All the sample code is based on MPF.
17 The sample is initiated by the thread on the forum:
18 http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/ddb0f935-b8ac-400d-9e3d-64d74be85031
21 //////////////////////////////////////////////////////////////////////////////
22 Prerequisites:
24 VS 2008 SDK must be installed on the machine. You can download it from:
25 http://www.microsoft.com/downloads/details.aspx?FamilyID=30402623-93ca-479a-867c-04dc45164f5b&displaylang=en
27 Otherwise the project may not be opened by Visual Studio.
29 If you run this project on a x64 OS, please also config the Debug tab of the project
30 Setting. Set the "Start external program" to 
31 C:\Program Files(x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe
33 NOTE: The Package Load Failure Dialog occurs because there is no PLK(Package Load Key)
34       Specified in this package. To obtain a PLK, please to go to WebSite:
35       http://msdn.microsoft.com/en-us/vsx/cc655795.aspx
36       More info
37       http://msdn.microsoft.com/en-us/library/bb165395.aspx
39 /////////////////////////////////////////////////////////////////////////////
41 Steps:
42 In order to implement this sample, following are the essential steps:
43 (For detailed informaiton, please view sample code)
45 1. Create ProvideReferencePageAttribute
46 This attribute is derived from RegistrationAttribute, so it main purpose 
47 is to write information into registry.
48 VSRoot\ComponentPickerPages\<Tab Name>
49 #AddToMru = 1
50 #ComponentType = .NET Assembly
51 #Package = <package guid>
52 #Page = <.Net user control guid>
53 #Sort = 0x35
55 2. Apply the ProvideReferencePageAttribute to the package
57 3. The package implements IVsComponentSelectorProvider interface
58 This interface has method GetComponentSelectorPage, which will be called 
59 when Visual Studio first time load add reference tabs.
61 So implement the GetComponentSelectorPage method and VSPROPSHEETPAGE 
62 structure to invoker.The most important thing is its hwndDlg, which should
63 be the handle of the tab page control.
65 4. Implement ReferencePageDialog by inheriting from UserControl
66 Add a ListView control into the user control
68 5. Handle ListView's OnSelectionChange and OnDoubleClick events
69 Send CPDN_SELCHANGED and CPDN_SELDBLCLICK messages to its great grandparent
70 respectively to notify for those two events.
72 6. Override the WinProc method and handle the following messages:
73 CPPM_INITIALIZELIST: Initialize the list
74 CPPM_QUERYCANSELECT: Check if select button is enabled
75 CPPM_SETMULTISELECT: Set if multiple select is supported
76 CPPM_CLEARSELECTION: Clear the selection
77 CPPM_GETSELECTION: Get selected items
79 7. Initialize the list
80 Add demo items into ListView control
82 8. Get selected items
83 See the HandleGetSelectionMessage method.
84 m.WParam = the count of the items
85 m.LParam = the pointer of VSCOMPONENTSELECTORDATA data array
88 /////////////////////////////////////////////////////////////////////////////
89 References:
91 Adding a tab to the Add Reference dialog
92 http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/ddb0f935-b8ac-400d-9e3d-64d74be85031
94 IDE Constants
95 http://msdn.microsoft.com/en-us/library/bb165453.aspx